package com.sss.hloster0304;

import java.util.Scanner;

public class TestSepStack {

	public static void main(String[] args) {
		test01();
	}

	private static void test01() {
		 Scanner sc = new Scanner(System.in);
		System.out.println("需要输入的字符串为：");
		String srt = sc.next();
		char[] ss = srt.toCharArray();
		// 创建一个空栈
		SepStack myStack = new SepStack();
		//int test[] = { 1, 3, 5, 7, 9 };
		int n = ss.length;
		try {
			// 依次将长度为5的整形数组中的数转换为Integer类型入栈
			for (int i = 0; i < n; i++) {
				myStack.push((ss[i]));
			}
			// 获取栈顶元素
			//System.out.println("当前栈顶元素为：" + myStack.getTop());
			System.out.println("元素出栈序列为：");
			while (myStack.notEmpty()) { // 判断栈是否为空
				System.out.print(myStack.pop()+"   ");// 逐个出栈
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());

		}
	}
}
